In here are the list of things I did for a particular hour or day. Also included here are the screenshots of games I played, or videos I watched or listened to, or just random things I stumbled upon. I'll occasionally write down what I'm thinking, or things I'm planning to do.
So I started a small project recently, against my other plans and priorities, henceforth I will designate as the "ant" project.
As the name implies, it has something to do with ants. Not literal ants though, but as a side note, I recently come across another mycmyrnae, no uh, mcmyrne, myrrnc... Myrmarachne is the word, which is a fancy name for spider-ant mimics, or spiders that pretends to be ants. It's either they are a rare bunch, or just hard to spot. In any case, ant mimics are a nice find when you see them.
The ant project will be primarily be about langton's ant Secondarily, the project will be anything related to cellular automata. The side goal is for me to have a nice UI playground for moving around blocks, for purposes of further developing my factoring algorithm.
Cellular automata are algorithmically straighforward to implement, but the question is which UI framework should I use. After some brief consideration, I just opted to use the web frontend (html+js), firstly because it's what I'm most familiar with, and second, because it's the easiest and cheapest stack to put things out there.
Initially, since I used lua for my static site, I opted to try fengari lua VM so I could still have all of my codebase in lua. This was a mistake though, since after 400 lines of crappy lua code, the web UI would stutter and lag with a grid size of 20x20. That's barely acceptable for me, because cellular automata are better with larger grids.
I thought maybe I was doing something wrong with the canvas API that was causing the lag. But I'm mostly just drawing a bunch of rectangles, surely it can't be that. So my hunch is that fengari is the problem.
I considered using p5js, but it was a large 1MB depedency, plus now I have to learn the p5js API, which would cause me to exceed the planned time budget.
The easiest fix is to try rewriting the lua code directly into javascript. After some mild frustration translating lua eccentricities to javascript, I managed to get it working and fix any weird bugs.
And the result: javascript code was way faster, even with 100x100 grids it performs smoothly. I guess the lesson of the day is that I should have tested how fengari would perform with hot loops.
Oh well, that's that.
site last updated on 2024-10-16 | created with moontpl